package com.gy.edu.home.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.gy.edu.R;

/**
 * Created by 高岳 on 2016/12/22.
 * Describe:首页课程列表
 */
public class HomeClassAdapter extends BaseAdapter {

    private Context context;
    private String[] titles = new String[]{"加工制造类【7】","信息技术类【2】","交通运输类【2】","土木水利类【1】","农林牧业类【1】","石油化工类【0】"};

    public HomeClassAdapter(Context context){
        this.context = context;
    }

    @Override
    public int getCount() {
        return titles.length;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = View.inflate(context, R.layout.adapter_home_class,null);
        TextView tvTitle = (TextView) convertView.findViewById(R.id.adapter_home_class_tv_name);
        ImageView img = (ImageView) convertView.findViewById(R.id.adapter_home_class_img_flag);
        tvTitle.setText(titles[position]);
//        if(position == 1){
//            img.setVisibility(View.VISIBLE);
//            img.setImageResource(R.mipmap.new_icon);
//        } else if(position == 2){
//            img.setVisibility(View.VISIBLE);
//            img.setImageResource(R.mipmap.hot_icon);
//        } else {
//            img.setVisibility(View.GONE);
//        }
        return convertView;
    }
}
